<?php

use yii\helpers\Html;
use yii\widgets\ActiveForm;
use app\modules\clinical\models\Patient;
use yii\widgets\Breadcrumbs;

/* @var $this yii\web\View */
/* @var $model app\models\Patient */
/* @var $form yii\widgets\ActiveForm */
$this->title = '创建家属关系';
$this->params['breadcrumbs'][] = ['label' => '临床信息', 'url' => ['index']];
$this->params['breadcrumbs'][] = ['label' => '家属关系', 'url' => ['/clinical/relative']];
$this->params['breadcrumbs'][] = $this->title;

$this->registerJsFile('@web/js/patient.js?v=1', ['depends' => 'app\assets\AppAsset']);

?>

<?= Breadcrumbs::widget([
  'homeLink' => ['label' => '医疗管理系统', 'url' => '#'],
  'links' => isset($this->params['breadcrumbs']) ? $this->params['breadcrumbs'] : [],
]) ?>

<div class="patient-form myForm">

  <?php $form = ActiveForm::begin([
      'method' => 'post',
      'action' => $model->isNewRecord ? 'create' : 'update?id='.$model->pk_id,
      'id' => 'PatientForm'
  ]); ?>

  <div class="alert alert-danger" id="error-msg"></div>

  <div class="form-group">
	  <?= Html::label('家属关系', ['class'=>'control-label']) ?><br />
	  <?= Html::dropDownList('pt_rel', 1, Patient::getParams('relation')) ?>
  </div>

  <?= $form->field($model, 'pt_name')->textInput()->error(false) ?>
  <div class="badge">ss</div>

  <?= $form->field($model, 'pt_sex')->dropDownList(Patient::getParams('sex')) ?><br />

  <?= $form->field($model, 'pt_birth')->textInput(['class'=>'form-control laydate-icon date'])->error(false) ?>

  <?= $form->field($model, 'pt_marry')->dropDownList(Patient::getParams('marry')) ?>

  <?= $form->field($model, 'pt_nation')->dropDownList(Patient::getParams('nation')) ?><br />

  <input type="hidden" id="status" value="create-relative"><br />
  <div class="form-group">
      <?= Html::submitButton($model->isNewRecord ? '保存' : '更新', ['class' => $model->isNewRecord ? 'btn btn-success' : 'btn btn-primary', 'id' => 'submitButton']) ?>

      <?= Html::a('取消', 'index', ['class' => 'btn btn-success']) ?>
  </div>
  
  <?php ActiveForm::end(); ?>

  <div class="crop-avatar">
      <?= $this->render('@app/views/layouts/media.php') ?>
  </div>

</div>
